< previous page page_329 next page >

Page 329
Example program Circle3 uses this code to display circles that have been scaled and rotated. Enter the scaling factors in the X and Y directions and the angle through which the circle should be rotated in degrees. Then click the Go button to make the program display the resulting rotated ellipse. You will not see the rotation if the scaling factors are the same because then the ellipse is a circle. Figure 11.4 shows a circle that has been scaled by a factor of 0.5 in the Y direction and then rotated 30 degrees.
Example programs Spiral2, BDitch2, and Cycloid2 use the same DrawCurve code to draw scaled and rotated spirals, Bowditch curves, and cycloids like the ones shown in Figure 11.5. The only differences between these programs are in their definitions of the parametric functions X(t) and Y(t). These functions define the basic curve shape for each program. The DrawCurve subroutine stretches and rotates these figures in exactly the same way for all three programs.
You can use similar techniques to scale and rotate any parametric curve. Chapter 12, Two-Dimensional Transformations, describes scaling and rotation transformations more generally, along with some other transformations such as reflecting a figure across a line and shape-distorting transformations. Chapter 12 also explains how you can combine transformations to perform complex actions like rotating a figure around an arbitrary point quickly and easily.
z0349-01.gif
Figure 11.4
A circle scaled by a factor of 0.5 in the Y direction and then rotated 30 degrees.

 
< previous page page_329 next page >